﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;

namespace 简单实现一个剪刀石头布游戏
{
    public partial class Form2 : Form
    {
        Game game = new Game();
        private Form1 _form1;
        public Form2()
        {
            InitializeComponent();
        }
        public Form2(Form1 form1)
        {
            InitializeComponent();
            _form1 = form1;
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            game.Show(new PictureBox[] {pictureBox1, pictureBox2,pictureBox3,pictureBox4,pictureBox5,pictureBox6,pictureBox7,pictureBox8});
        }

        private void pictureBox6_Click(object sender, EventArgs e)
        {
            pictureBox10.Image = pictureBox6.Image;
            game.Play(pictureBox9, 2, label1, label2);
        }

        private void pictureBox7_Click(object sender, EventArgs e)
        {
            pictureBox10.Image = pictureBox7.Image;
            game.Play(pictureBox9, 3, label1, label2);
        }

        private void pictureBox8_Click(object sender, EventArgs e)
        {
            pictureBox10.Image = pictureBox8.Image;
            game.Play(pictureBox9, 4, label1, label2);
        }

        private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {
            _form1.Close();
        }
    }
}
